<template>
  <div>
    <h3>当前最新的count值为： {{this.$store.state.count}}</h3>
    <h3>{{showNum}}</h3>
    <button @click="subNAsync(3)">-NAsync</button>
    <button @click="subN(4)">-N</button>
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions, mapGetters } from 'vuex'
export default {
  data () {
    return {}
  },
  methods: {
    // vuex中定义的异步方法调用
    ...mapActions(['subNAsync']),
    ...mapMutations(['subN'])
  },
  computed: {
    // 引入 vuex中定义的变量
    ...mapState(['count']),
    // 引入 vuex中定义getter方法
    ...mapGetters(['showNum'])
  }
}
</script>

<style scoped>
</style>>
